chrome.extension.onRequest.addListener(
    function(req, sender, sendResponse){
        if(req.method == "getSelection")
            sendResponse({data: window.getSelection().toString()});
        else
            sendResponse({});
    });